//
//  Brand_ExploreRecommendBrand_Scr_WX.m
//  ZITHER
//
//  Created by weixin on 2019/5/20.
//  Copyright © 2019 weixn. All rights reserved.
//

#import "Brand_ExploreRecommendBrand_Scr_WX.h"
#import "Brand_ExploreRecommendBrandImg_View_WX.h"

@implementation Brand_ExploreRecommendBrand_Scr_WX


-(void)setBFModel:(goodsBrandMyFollowModel *)BFModel{
    _BFModel = BFModel;


    [self addScrImage];
    
}

-(void)addScrImage{
    
    NSInteger arrCount = self.BFModel.list.count;
    
        if (arrCount == 0 || self.BFModel.list == nil) {
            self.hidden = YES;
            return;
        }
    
    CGFloat w = 100;
    CGFloat h = 120;
    CGFloat spacing = 10;
    
    
    self.hidden = NO;
    [self.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
    self.contentSize = CGSizeMake(arrCount*(w+spacing)+10,0);
    self.userInteractionEnabled = YES;
    
    for (int j = 0; j<arrCount; j++) {
        [self addImage:j];
    }
}

-(void)addImage:(int)j{
    CGFloat w = 100;
    CGFloat h = 120;
    CGFloat spacing = 10;
    Brand_ExploreRecommendBrandImg_View_WX *imageV2 = [[Brand_ExploreRecommendBrandImg_View_WX alloc]init];
    imageV2.frame = CGRectMake(j*(w+spacing)+10,0, w,h);
    [self addSubview:imageV2];
    imageV2.modelSub = self.BFModel.list[j];
    //    imageV2.model = self.arr[j];
    [[imageV2 addTag]subscribeNext:^(id  _Nullable x) {
        [self pushVC:j];
    }];
    
    imageV2.tag = j +100;
    
}

-(void)pushVC:(int)j{
    
}

 
// -(void)setArr:(NSArray<Tipe_Model_WX *> *)arr{
// _arr = arr;
//
// [self addScrImage];
//
// }




@end
